import {Routes, RouterModule}  from '@angular/router';
import {Pages} from './pages.component';
import {LoginGuard, AdminGuard} from '../filter/app.guard';
import {HeroesModule} from './heroes/heroes.module';

const routes:Routes = [
    {
        path: '',
        redirectTo: 'login',
        pathMatch: 'full',
    },
  {
        path: 'login',
        loadChildren: './login/login.module#LoginModule'
    },
    {
        path: 'register',
        loadChildren: './register/register.module'
    },
  /*{
    path: 'hero',
    loadChildren: './heroes/heroes.module#HeroesModule'
  },*/
    {
        path: 'forgot',
        loadChildren: './forgot/forgot.module#ForgotModule'

    },
    {
        path: 'passwordreset',
        loadChildren: './passwordreset/passwordreset.module#PasswordresetModule'
    },
    {
        path: 'pages',
        loadChildren: './dashboard/dashboard.module'
    },
    {
        path: '',
        component: Pages,
        children: [
            {path: 'dashboard', loadChildren: './dashboard/dashboard.module#DashboardModule'},
            {path: 'postidea', loadChildren: './postidea/postIdea.module#PostIdeaModule'},
            {path: 'listidea', loadChildren: './listidea/listidea.module#ListideaModule'},
            {path: 'profile', loadChildren: './profile/profile.module#ProfileModule'},
            {path: 'leaderboard', loadChildren: './leaderboard/leaderboard.module#LeaderBoardModule'},
            {path: 'editidea', loadChildren: './editidea/editidea.module#EditideaModule'},
            {path: 'recent', loadChildren: './Recent/recent.module#RecentModule'},
            {path: 'admin', loadChildren: './admin/admin.module#AdminModule',  canActivate: [
                AdminGuard
            ]},
            {path: 'allTime', loadChildren: './allTime/allTime.module'}
        ],
        canActivate: [
            LoginGuard,
        ]
    }
];

export const routing = RouterModule.forChild(routes);
